//掷色子
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int q;
	int geshu;
	int sides;
	printf("输入需要的盘数;使用q退出\n");
	while (scanf_s("%d", &q,3) == 1)
	{
		printf("输入多面体的面数：");
		scanf_s("%d", &sides, 3);
		printf("\n输入同时投掷的个数：");
		scanf_s("%d",&geshu, 3);
		int i,j;
		int mid=0;
		for (i =1; i <= q; i++)
		{
			for (j = 1; j <= geshu; j++)
			{
				mid =mid+ rand() % sides + 1;
			}
			printf("%4d\n", mid);
			mid = 0;
		}
	}
	printf("done.\n");
	return 0;
}